import {Injectable} from '@angular/core';
import {Http, Headers} from "@angular/http";
import {Employee} from "./employee";
import 'rxjs/add/operator/toPromise'

@Injectable()
export class EmployeesService {
  private url = 'api/employees';
  private header = new Headers().append("Content-Type", "application/json");

  constructor(private http: Http) {
  }

  getAllEmployees(): Promise<Employee[]> {
    return this.http.get(this.url).toPromise().then(response => response.json().data as Employee[]);
  }

}
